home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
lcppb.zip
/
LCPP09.ZIP
/
POINTOUT.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1991-07-08
|
866b
|
44 lines
// pointout.cpp -- Demonstrate overloading output streams
//#include <stream.hpp>
#include <iostream.h>
class point {
private:
int x, y;
public:
point() { x = y = 0; }
point(int xx, int yy) { x = xx; y = yy; }
void putx(int xx) { x = xx; }
void puty(int yy) { y = yy; }
int getx(void) { return x; }
int gety(void) { return y; }
friend ostream& operator<<(ostream& os, point &p);
};
main()
{
point p;
cout << p << '\n';
p.putx(100);
p.puty(200);
cout << p << '\n';
}
ostream& operator<<(ostream& os, point &p)
{
os << "x == " << p.x << ", y == " << p.y;
return os;
}
// Copyright (c) 1990 by Tom Swan. All rights reserved
// Revision 1.00 Date: 11/24/1990 Time: 11:12 pm
// Revision 1.01 Date: 07/08/1991 Time: 05:41 pm
// Converted for Borland C++ 2.0